﻿using MediatR;
using S.EarTag.Domain.Model;
using S.EarTag.Infrastructure.Repository.Interface.IEarTagRepository;
using S.EarTag.Read.API.Application.MediatorCommand.AppearanceCommand;

namespace S.EarTag.Read.API.Application.MediatorCommandHandler.AppearanceCommandHandler
{
    public class AppearanceEarTagCommandHandler : IRequestHandler<AppearanceEarTagCommand, AppearanceModel>
    {
        private readonly IAppearanceModelRepository _appearanceModelRepository;
        public AppearanceEarTagCommandHandler(IAppearanceModelRepository appearanceModelRepository)
        {
            _appearanceModelRepository= appearanceModelRepository;
        }
        /// <summary>
        /// 根据可视耳号反填查询——品相测量
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public async Task<AppearanceModel> Handle(AppearanceEarTagCommand request, CancellationToken cancellationToken)
        {
            return await _appearanceModelRepository.GetAppearanceEarTag(request.EarTag);
        }
    }
}
